package com.own.component.util.math.handler;

import com.own.component.common.model.ExceptionMessageModel;
import com.own.component.util.math.exception.MathException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * MathExceptionHandler
 *
 * @author chenxueli
 * @date 2022-06-15 03:14:15
 */
@Slf4j
@Order(89)
@RestControllerAdvice
public class MathExceptionHandler {

    @ExceptionHandler(MathException.class)
    public ExceptionMessageModel handleException(MathException e) {
        log.error(e.getMessage());
        return new ExceptionMessageModel(e);
    }

}
